from abc import ABC, abstractmethod
class Food(object):
    def __init__(self, name):
        self._name = name

    @property
    def name(self):
        return self._name

    @name.setter
    def name(self, value):
        self._name = value

class Animal(ABC):
    def __init__(self, name):
        self._name = name

    @property
    def name(self):
        return self._name

    @name.setter
    def name(self, value):
        if isinstance(value, str):
            self._name = value
        else:
            print("参数非法！")

    @abstractmethod
    def eat(self, food: Food):...

class Dog(Animal):
    def __init__(self, name):
        super().__init__(name)

    def eat(self, food: Food):
        print(f'{self.name}正在吃{food.name}')

    def boom(self):
        print(f'{self.name}正在疯狂炸碉堡...')

class Cat(Animal):
    def __init__(self, name):
        super().__init__(name)

    def eat(self, food: Food):
        print(f'{self.name}正在吃{food.name}')

    def act_cute(self):
        print(f'{self.name}正在疯狂卖萌...')

class Bone(Food):
    def __init__(self, name):
        super().__init__(name)

class Fish(Food):
    def __init__(self, name):
        super().__init__(name)

class Person(object):
    def __init__(self, name):
        self.name = name.title()

    def feed(self, animal: Animal, food: Food):
        print(f'{self.name}正在给{animal.name}喂{food.name}')
        animal.eat(food)
        if isinstance(animal, Dog):
            animal.boom()
        elif isinstance(animal, Cat):
            animal.act_cute()


person = Person('你哥')
dog = Dog('Dog')
cat = Cat('Cat')
bone = Bone('Bone')
fish = Fish('Fish')

person.feed(dog, bone)
person.feed(cat, fish)

